Component({
  properties: {
    title: {
      type: String,
      value: ''
    },
    time: {
      type: String,
      value: ''
    },
    type: {
      type: String,
      value: '1' // 1:日常提醒, 2:洗护提醒, 3:清洁提醒, 4:用药提醒
    },
    completed: {
      type: Boolean,
      value: false
    }
  },

  data: {
    typeClass: ''
  },

  lifetimes: {
    attached() {
      // 根据类型设置样式类
      const typeClasses = {
        '1': 'first',
        '2': 'second',
        '3': 'third',
        '4': 'forth'
      };
      
      this.setData({
        typeClass: typeClasses[this.data.type] || 'first'
      });
    }
  },

  methods: {
    toggleComplete() {
      // 触发自定义事件，将完成状态取反
      this.triggerEvent('toggle', {
        completed: !this.data.completed
      });
    }
  }
});